package my.test.responsibilitychain.best;

import my.test.responsibilitychain.IWomen;

import java.util.ArrayList;
import java.util.Random;

/**
 * @Author 许玉康
 * @Date 2019/7/16 9:41
 */
public class Client {

    public static void main(String[] args) {

        Random random = new Random();
        ArrayList<IWomen> arrayList = new ArrayList<>();
        for (int i = 0; i < 5; i++) {
            arrayList.add(new Women(random.nextInt(4), "我要去逛街"));
        }

        //定义三个请示对象
        Handler father = new Father();
        Handler huaband = new Husband();
        Handler son = new Son();

        father.setNext(huaband);
        huaband.setNext(son);
        for(IWomen women : arrayList) {
            father.HandleMessage(women);
        }
    }
}
